using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Elementum
{
    class AlphaTransition : DefauldTransition
    {
        public delegate void TransitionDoneActionHandler();
        public event TransitionDoneActionHandler TransitionDoneAction;

        public AlphaTransition(string path,float startAlpha, float endAlpha, int start, int end)
            : base(startAlpha,endAlpha, start, end)
        {
            _back = new Animation(path, new Point(800, 480));
            _back.Alpha = startAlpha;
            _alpha = (endAlpha - startAlpha) / (end - start);
        }

        public AlphaTransition(Animation ani, float startAlpha, float endAlpha, int start, int end)
            : base(startAlpha, endAlpha, start, end)
        {
            _back = ani;
            _back.Alpha = startAlpha;
            _alpha = (endAlpha - startAlpha) / (end - start);
        }

        protected override void TransitionDone()
        {
            //_stage.TransitionList.Remove(this);
            if (_stage.TransitionList.Count() == 0)
                _stage.LockTouch = false;
            if (TransitionDoneAction != null)
                TransitionDoneAction();
        }



    }
}
